using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HengTong.Model.Db.SupplyChain.Warehouse;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Db.SupplyChain.Material;

/// <summary>
/// 系统物料信息
/// 用于管理供应链中的物料基础数据，包含物料的基本信息、分类、计量单位、价格等
/// </summary>
public class SysMaterial : BasePoco
{
    /// <summary>
    /// 物料名称
    /// </summary>
    [Display(Name = "名称", Description = "物料名称")]
    [Required]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Name { get; set; }

    /// <summary>
    /// 物料唯一编码，用于系统内标识物料
    /// </summary>
    [Display(Name = "编码", Description = "物料唯一编码，用于系统内标识物料")]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Code { get; set; }
    
    /// <summary>
    /// 物料所属分类
    /// </summary>
    [Display(Name = "分类", Description = "物料所属分类")]
    public SysMaterialGroup MaterialGroup { get; set; }

    /// <summary>
    /// 物料分类ID
    /// </summary>
    [Display(Name = "分类", Description = "物料分类ID")]
    public Guid? MaterialGroupId { get; set; }
    
    /// <summary>
    /// 物料详细描述信息
    /// </summary>
    [Display(Name = "详情", Description = "物料详细描述信息")]
    [StringLength(1024, ErrorMessage = "{0}长度不能超过{1}")]
    public string Description { get; set; }
    
    /// <summary>
    /// 物料当前状态（启用/禁用/废弃等）
    /// 启用: 正常
    /// 禁用: 暂时不可用
    /// 废弃: 有新的版本号在使用, 不再使用该物料
    /// </summary>
    [Display(Name = "状态", Description = "物料当前状态（启用/禁用等）")]
    public CommonState State { get; set; }
    
    /// <summary>
    /// 物料计量单位信息
    /// </summary>
    [Display(Name = "计量单位", Description = "物料计量单位信息")]
    public SysMeasureUnit Unit { get; set; }
    
    /// <summary>
    /// 计量单位ID
    /// </summary>
    [Display(Name = "计量单位", Description = "计量单位ID")]
    public Guid? UnitId { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    [Display(Name = "备注", Description = "计量单位组的备注信息")]
    [StringLength(256)]
    public string Remark { get; set; }
    
    /// <summary>
    /// 物料SKU列表
    /// </summary>
    [Display(Name = "物料SKU列表", Description = "物料SKU列表")]
    public List<SysMaterialSku> Skus { get; set; }
    
    /// <summary>
    /// 物料属性列表
    /// </summary>
    [Display(Name = "物料属性列表", Description = "物料属性列表")]
    public List<SysMaterialAttribute> Attributes { get; set; }
    
    /// <summary>
    /// 版本号
    /// </summary>
    [Display(Name = "版本号", Description = "物料记录的版本号")]
    public int Version { get; set; }
    
    /// <summary>
    /// 流水号
    /// </summary>
    [Display(Name = "流水号", Description = "物料分类的流水号")]
    public uint SerialNumber { get; set; }
}